using System;

//CID 0140 //2008.12.08 //Begin
namespace InfoJetSoft.Service.XPath.Tokens
{
	/// <summary>
	/// Summary description for LiteralReader.
	/// </summary>
	class LiteralReader
	{
		public static Token Read( TokenReader tokenReader, int nextChar )
		{
			if (nextChar == 34 || nextChar == 39)  //" '
			{
				tokenReader.MoveNextIndex(1);
				
				int delimiter = nextChar;
				string literal = "";
				nextChar = tokenReader.LookupNextChar(1);
				while( nextChar != -1 && nextChar != delimiter )
				{
					literal = literal + Char.ToString( (char)nextChar );
					tokenReader.MoveNextIndex(1);
					nextChar = tokenReader.LookupNextChar(1);
				}
				if( nextChar == delimiter )
				{
					tokenReader.MoveNextIndex(1);
				}
				return new Token( TokenType.Literal, literal );
			}
			return null;
		}
	}
}
//CID 0140 //2008.12.08 //End
